Once EcoreTools is installed in your environment, you can start using it either to create a new Ecore model from scratch or to edit an already existing model.
EcoreTools provide a wizard setting up your Ecore project. Click on File->New->Others... and then select Ecore Modeling Project.
The next page request a project name. The general convention is to use a java namespace notation for your project name. The project which is going to be created actually is an Eclipse plugin project, the name will be used for the plugin identification.
Changing the project name afterward is possible though error-prone and not without impact. Its better to get it right from the beginning.
The next page request information about your Ecore model.
Here again, you can keep the default nsURI but keep in mind that its going to be the identifier of your domain within the EMF world. Changing it afterward might requires to update several files.
The next wizard page request which Viewpoints should be enabled. Viewpoints are a way to adapt the tooling – here EcoreTools itself – regarding your current activity for instance Designing or Reviewing your Ecore model. If you are really getting started, Design is a good choice, in case of doubt, select everything.
Once you clicked on Finish and the wizard prepared the project, this is what you should have.
The Modeling Project is a facility provided by Sirius which handles models within the scope of a project. What does that mean ? Any model which is in the project is going to be loaded by Sirius behind the scene and its elements will be available in your editors.
This mode of usage is designed so that you can work with your models easily, but you might want to have more control. In this case, you can use EcoreTools just by creating Representations Files.
Each modeling project has a set of viewpoints which are enabled. This controls what kind of representations you can create on the Ecore models inside the project.
To select which viewpoints are enabled on your project, simply use the Viewpoints Selection action in the context menu of the project itself.
Once the
Viewpoints are selected you can create representations : diagrams or tables. All these representations are stored in the
.aird file within the project.
There are several ways to create a representation. You can browse a model in a modeling project and right click on New Representation.
Depending on the type of model element you clicked on, different types or representations might be provided. For instance if you right-click on an
EPackage you will have :
And other representations might be created on a
GenPackage :
You can also create a new representation by clicking on the
Modeling Project itself :
And then select the kind of representation you want to create.
In this case the tool will guide you to select a model element for which this representation makes sense.
It is possible to load models which are not in the current project by adding
Project Dependencies. You can right click on the
Project Dependencies item and add another Ecore file (or type the complete URI)
Several layers are provided by the editor. When activating a layer some shapes and colors will changes and specific tools will be available to address your current concern.
For example, activating the Documentation layer will transform the shape of all the model elements to add a red border if it is not documented. Two new tools are appearing then in the palette so that you can create the doc annotations.
If the layer
Validation is enabled, then any invalid element will have red borders. To understand what is the error exactly, just keep your mouse pointer above the element and the tooltip will provide you a textual feedback.
A lot of shortcuts are available to be more efficient when editing an Ecore model. From a general point of view, just edit the label of a given shape and the diagram editor will try to figure out what you want to edit. For instance:
1 on an
EAttribute or
EReference will switch the cardinality to
1..x without updating anything else.
* on an
EAttribute or
EReference will switch the cardinality to
x..*
:SomeTypeName will set the type of an
EAttribute without updating the name.
someName will update the name, keeping the type and cardinality as-is.
Shortcuts appearing contextually to a given
EClass will allow you to quickly switch the
EClass to being
abstract or
interface
Editing the genmodel
Launching
You can interact with the team behind EcoreTools by using the Eclipse Forum